package com.lzh.thinkpet.service;

import com.lzh.thinkpet.dao.AdminMapper;
import com.lzh.thinkpet.model.Admin;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author lzh
 * @date 2019/1/22 - 9:29
 */
@Transactional
@Service
public class AdminServiceImpl implements AdminService{

    @Autowired
    private AdminMapper adminMapper;

    @Override
    public List<Admin> findAllAdmin() {
        return adminMapper.findAllAdmin();
    }

    @Override
    public boolean existsThisAname(String uname) {
        int result = adminMapper.selectByAname(uname);
        if (result ==1){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public boolean isTrueThisApass(String uname ,String upass) {
        String apass = adminMapper.selectApassByAname(uname);
        if (StringUtils.equals(upass,apass)){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public boolean deleteByPrimaryKey(Integer id) {
        return false;
    }

    @Override
    public boolean insert(Admin record) {
        return false;
    }

    @Override
    public boolean insertSelective(Admin record) {
        return false;
    }

    @Override
    public Admin selectByPrimaryKey(Integer id) {
        return adminMapper.selectByPrimaryKey(id);
    }

    @Override
    public boolean updateByPrimaryKeySelective(Admin record) {
        return false;
    }

    @Override
    public boolean updateByPrimaryKey(Admin record) {
        return false;
    }
}
